package com.xdb.sqlparser.dialect.mysql.ast.statement;

import java.util.ArrayList;
import java.util.List;

import com.xdb.sqlparser.ast.SQLExpr;
import com.xdb.sqlparser.ast.SQLName;
import com.xdb.sqlparser.dialect.mysql.visitor.MySqlASTVisitor;

public class MySqlPartitionByList extends MySqlPartitioningClause {

	private SQLExpr expr;

	private List<SQLName> columns = new ArrayList<SQLName>();

	private SQLExpr partitionCount;

	@Override
	public void accept0(MySqlASTVisitor visitor) {
		if (visitor.visit(this)) {
			acceptChild(visitor, expr);
			acceptChild(visitor, columns);
			acceptChild(visitor, partitionCount);
			acceptChild(visitor, getPartitions());
		}
		visitor.endVisit(this);
	}

	public SQLExpr getExpr() {
		return expr;
	}

	public void setExpr(SQLExpr expr) {
		if (expr != null) {
			expr.setParent(this);
		}
		this.expr = expr;
	}

	public SQLExpr getPartitionCount() {
		return partitionCount;
	}

	public void setPartitionCount(SQLExpr partitionCount) {
		this.partitionCount = partitionCount;
	}

	public List<SQLName> getColumns() {
		return columns;
	}

	public void setColumns(List<SQLName> columns) {
		this.columns = columns;
	}

}
